-
-
Notifications
You must be signed in to change notification settings - Fork 75
Update adjust-selector-specificity.ts #951
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Uses a smaller `:not` rule to bump specificty.
Hi @nmn, thank you for your contribution. This change would break the cascade layers fallback for older browsers. Was there some issue in particular you are trying solve? |
} | ||
|
||
return list; | ||
return `:not(${list})`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
breaks support for older browser versions : https://developer.mozilla.org/en-US/docs/Web/CSS/:not#browser_compatibility
@nmn Going to close this pull requests because this change would limit the usefulness of the plugin, but please open an issue if there are any problems you are trying to solve. |
Looking at the MDN page, only selector “lists” seem to be a new feature. A repeated ID selector should work even in older browsers? I will reopen once I can test support. Thanks! |
A repeated ID selector doesn't produce the right specificity, so that would definitely not work :) You can test this by running These tests will fail if you change the plugin to produce Also, we tested this extremely thoroughly, if there was a way to produce smaller CSS we would change to that in a heartbeat, but the current implementation is exactly as it should be :) |
@romainmenke My fix would have generated However, I tested in Chrome 49 (as that is the oldest browser I need to support at work) and as stated, the double ID selector failed to work. This is surprising to me because the new part of the specification is “selector lists” (many selectors separated by a comma). However, testing beats looking at specifications. I guess the polyfill can’t be made any smaller! Thanks for taking the time! |
The old version of It is true that the MDN labeling is confusing :) |
Uses a smaller
:not
rule to bump specificty.